const { createProxyMiddleware } = require("http-proxy-middleware")
module.exports = function (app) {
  app.use(
    createProxyMiddleware("/api", {
      // http://codercba.com:9002 
      // 'https://music.mereith.com'
      target: 'http://codercba.com:9002', //配置转发目标地址(能返回数据的服务器地址)
      changeOrigin: true, //控制服务器接收到的请求头中host字段的值
      pathRewrite: { "^/api": "" },
    }),
    createProxyMiddleware("/api1", {
      target: 'https://api-unm.mzsq.top', //配置转发目标地址(能返回数据的服务器地址)
      // changeOrigin: true, //控制服务器接收到的请求头中host字段的值
      pathRewrite: { "^/api1": "" },
    }),
  )
}